using System;
using DSS_XNA.Engine.Log;
using DSS_XNA.Engine.Util;

namespace DSS_XNA
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread()]
        static void Main(string[] args)
        {
            do
            {
                // we don't want to keep restarting
                Game1.IsToRestartGame = false;

                using (Game1 game = new Game1())
                {
                    try
                    {
                        Logger.LogPath = Util.GetFullPath("log\\log.txt");

                        game.Run();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exiting system due to internal error", LogLevel.Critical);
                        Logger.Log(ex.Message, LogLevel.Critical);
                        if (ex.InnerException != null)
                            Logger.Log(ex.InnerException.Message, LogLevel.Critical);
                        Logger.Log(ex.StackTrace, LogLevel.Critical);
                    }
                    finally
                    {
                    }
                }
            } while (Game1.IsToRestartGame);
        }
    }
}

